/**
 * signals.c : Demonstrate how to use signals
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

void catch1(int signum);

int main(int argc, char **argv)
{
        /* Intercept signal */
        signal(SIGTSTP, catch1);

        printf("\nI'am waiting for the signal...\n");
        fflush(stdout);
        while(1);

        return;
}


/**
 * handler for signal 
 */
void catch1(int signum)
{
        if(signum == SIGTSTP) {
                printf(" I got it!\n");
                fflush(stdout);
                //exit(EXIT_SUCCESS);
        }
}
